#◊site/notes
Assigning default values to shell variables with a single command in bash - Stack Overflow
FOO="${VARIABLE:-default}"  # If variable not set or null, use default.
# If VARIABLE was unset or null, it still is after this (no assignment done).
FOO="${VARIABLE:=default}"  # If variable not set or null, set it to default.
Catch your errors:
#!/bin/bash
set -eu -o pipefail
set -e — halt on errors (non-zero exit from subprocesses)set -u — halt on unset variablesset -o pipefail  — halt if a pipeline component fails